package com.cloud.qualitycontrol.dao;

import com.cloud.qualitycontrol.model.QualityNode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Set;

public interface QualityTreeRepository extends JpaRepository<QualityNode, String> {

    @Query("select t from QualityNode t where t.parentId = ?1")
    Set<QualityNode> getByParentIdOrderByCreateTime(final String parentId);

    @Query("select qNode from QualityNode qNode where qNode.rootId = ?1")
    Set<QualityNode> getByRootIdOrderByCreateTime(final String rootId);

}
